<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 10] Short</TITLE>
<META NAME="author" CONTENT="Mark Grand">
<META NAME="date" CONTENT="Fri Aug  8 15:27:01 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="java">
<META NAME="title" CONTENT="Java Language Reference">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java Language Reference" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch10_18.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 10<br>The java.lang Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch10_20.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>Short</H1>

<H2>Name</H2>

Short

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.138">Synopsis</A></h2>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Class Name:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Short</tt> 

<p>
<DT CLASS=varlistentry>Superclass:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Number</tt> 

<p>
<DT CLASS=varlistentry>Immediate Subclasses:<br>
<DD>

<P CLASS=para>
None 

<p>
<DT CLASS=varlistentry>Interfaces Implemented:<br>
<DD>

<P CLASS=para>
None 

<p>
<DT CLASS=varlistentry>Availability:<br>
<DD>

<P CLASS=para>
New as of JDK 1.1 </DL>
</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.139">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>Short</tt> class provides an object wrapper for a <tt CLASS=literal>short</tt> 
value. This is useful when you need to treat a <tt CLASS=literal>short</tt> 
value as an object. For example, there are a number of utility methods 
that take a reference to an <tt CLASS=literal>Object</tt> as one of their arguments. 
You cannot specify a <tt CLASS=literal>short</tt> value for one of these arguments, 
but you can provide a reference to a <tt CLASS=literal>Short</tt> object that 
encapsulates the <tt CLASS=literal>byte</tt> value. Furthermore, the <tt CLASS=literal>Short</tt> 
class is necessary as of JDK 1.1 to support the Reflection API
and class literals.

<P CLASS=para>
The <tt CLASS=literal>Short</tt> class also provides a number of utility methods 
for converting <tt CLASS=literal>short</tt> values to other primitive types 
and for converting <tt CLASS=literal>short</tt> values to strings and vice-versa. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.140">Class Summary</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public final class java.lang.Short extends java.lang.Number {
  // Constants
  public static final short MAX_VALUE;
  public static final short MIN_VALUE;
  public static final Class TYPE;
  // Constructors
  public Short(short value);
  public Short(String s);
  // Class Methods
  public static Short decode(String nm);
  public static short parseShort(String s);
  public static short parseShort(String s, int radix);
  public static String toString(short s);
  public static Short valueOf(String s, int radix);
  public static Short valueOf(String s);
  // Instance Methods
  public byte byteValue();
  public double doubleValue();
  public boolean equals(Object obj); 
  public float floatValue();
  public int hashCode();
  public int intValue();
  public long longValue();
  public short shortValue();
  public String toString();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.141">Constants</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.324">MAX_VALUE</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.365">public static final short MAX_VALUE= 32767</A></h4>

<P CLASS=para>
The largest value that can be represented by a <tt CLASS=literal>short</tt>. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.325">MIN_VALUE</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.366">public static final byte MIN_VALUE= -32768</A></h4>

<P CLASS=para>
The smallest value that can be represented by a <tt CLASS=literal>short</tt>. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.326">TYPE</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.367">public static final Class TYPE</A></h4>

<P CLASS=para>
The <tt CLASS=literal>Class</tt> object that represents 
the primitive type <tt CLASS=literal>short</tt>. 
It is always true that <tt CLASS=literal>Short.TYPE</tt> 
<tt CLASS=literal>==</tt> <tt CLASS=literal>short.class</tt>.

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.142">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.327">Short</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.368">public Short(short value)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>value</tt><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>short</tt> 
value to be encapsulated by this object. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Creates a <tt CLASS=literal>Short</tt> object with the specified <tt CLASS=literal>short</tt> 
value. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.369">public Short(String s) throws NumberFormatException</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>

The string to be made into a <tt CLASS=literal>Short</tt> object. 
</DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NumberFormatException</tt><br>
<DD>

<P CLASS=para>

If the sequence of characters in the given <tt CLASS=literal>String</tt> does 
not form a valid <tt CLASS=literal>short</tt> literal. 
</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Short</tt> object with the value specified by 
the given string. 
The string should consist of one or more digit characters.
The digit characters can be preceded by a single `<tt CLASS=literal>-</tt>'  character.
If the string contains any other characters, the constructor 
throws a <tt CLASS=literal>NumberFormatException</tt>.</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.143">Class Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.328">decode</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.370">public static Short decode(String nm) throws NumberFormatException</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>nm</tt><br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>String</tt> representation of the value to be 
encapsulated by a <tt CLASS=literal>Short</tt> object. If the 
string begins with <tt CLASS=literal>#</tt> or 
<tt CLASS=literal>0x</tt>, it is a radix 16 representation of the value.  
If the string begins with <tt CLASS=literal>0</tt>, it is a radix 
8 representation of the value. Otherwise, it is assumed to be a 
radix 10 representation of the value.
</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>Short</tt> object that encapsulates the given value.

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NumberFormatException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>String</tt> contains any non-digit characters 
other than a leading minus sign or the value represented by the 
<tt CLASS=literal>String</tt> is less than <tt CLASS=literal>Short.MIN_VALUE</tt>
or greater than <tt CLASS=literal>Short.MAX_VALUE</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a <tt CLASS=literal>Short</tt> 
object that encapsulates the given value.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.329">parseByte</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.371"><DIV CLASS=screen> <P> <PRE> public static short parseShort(String s) throws NumberFormatException </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>String</tt> 
to be converted to a <tt CLASS=literal>short</tt> value. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The numeric value of the <tt CLASS=literal>short</tt> 
represented by the <tt CLASS=literal>String</tt> object. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NumberFormatException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>String</tt> does not contain a valid representation 
of a <tt CLASS=literal>short</tt> or
the value represented by the 
<tt CLASS=literal>String</tt> is less than <tt CLASS=literal>Short.MIN_VALUE</tt>
or greater than <tt CLASS=literal>Short.MAX_VALUE</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the numeric value of the <tt CLASS=literal>short</tt> 
represented by the contents of the given <tt CLASS=literal>String</tt> object. 
The <tt CLASS=literal>String</tt> must contain only decimal digits, except that 
the first character may be a minus sign. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.372"><DIV CLASS=screen> <P> <PRE> public static short parseShort(String s, int radix) throws NumberFormatException </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>String</tt> to be converted to a short value.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>radix</tt><br>
<DD>

<P CLASS=para>
The radix used in interpreting the characters in the <tt CLASS=literal>String</tt> as
digits. This value must be in the range <tt CLASS=literal>Character.MIN_RADIX</tt> to
<tt CLASS=literal>Character.MAX_RADIX</tt>.  If radix is in the range 2 through 10, only
characters for which the <tt CLASS=literal>Character.isDigit()</tt> method returns <tt CLASS=literal>true</tt> are
considered to be valid digits. If <tt CLASS=literal>radix</tt> is in the range 11 through 36,
characters in the ranges `A' through `Z' and
`a' through `z' are considered valid
digits.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The numeric value of the <tt CLASS=literal>short</tt> 
represented by the <tt CLASS=literal>String</tt> object in the specified radix. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NumberFormatException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>String</tt> does not contain a valid representation 
of a <tt CLASS=literal>short</tt>, radix is not in the appropriate range, or
the value represented by the 
<tt CLASS=literal>String</tt> is less than <tt CLASS=literal>Short.MIN_VALUE</tt>
or greater than <tt CLASS=literal>Short.MAX_VALUE</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the numeric value of the <tt CLASS=literal>short</tt> 
represented by the contents of the given <tt CLASS=literal>String</tt> object 
in the specified radix. The <tt CLASS=literal>String</tt> must contain only 
valid digits of the specified radix, except that the first character may 
be a minus sign. The digits are parsed in the specified radix to produce 
the numeric value. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.330">toString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.373">public String toString(short s)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>short</tt> 
value to be converted to a string. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>string</tt> representation of the given value. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a <tt CLASS=literal>String</tt> object that contains the 
decimal representation of the given value.

<P CLASS=para>
This method returns a string that begins with `<tt CLASS=literal>-</tt>' if the given 
value is negative. The rest of the string is a sequence of one or more 
of the characters `0', `1', `2', `3', 
`4', `5', `6', `7', `8', 
and `9'. This method returns "0" if its argument 
is <tt CLASS=literal>0</tt>. Otherwise, the string returned by this method does 
not begin with "0" or "-0". </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.331">valueOf</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.374">public static Short valueOf(String s) throws NumberFormatException</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The string to be made 
into a <tt CLASS=literal>Short</tt> object. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>Short</tt> object constructed from the string. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NumberFormatException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>String</tt> does not contain a valid representation 
of a <tt CLASS=literal>short</tt> or
the value represented by the 
<tt CLASS=literal>String</tt> is less than <tt CLASS=literal>Short.MIN_VALUE</tt>
or greater than <tt CLASS=literal>Short.MAX_VALUE</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Short</tt> object with the value specified by 
the given string. 
The string should consist of one or 
more digit characters. The digit characters can be preceded by a 
single `<tt CLASS=literal>-</tt>'. If the string contains any other characters, the 
method throws a <tt CLASS=literal>NumberFormatException</tt>.</DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.375"><DIV CLASS=screen> <P> <PRE> public static Short valueOf(String s, int radix) throws NumberFormatException </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>s</tt><br>
<DD>

<P CLASS=para>
The string to be made into a <tt CLASS=literal>Short</tt> object.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>radix</tt><br>
<DD>

<P CLASS=para>
The radix used in converting the string to 
a value. This value must be in the range <tt CLASS=literal>Character.MIN_RADIX</tt> 
to <tt CLASS=literal>Character.MAX_RADIX</tt>. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The <tt CLASS=literal>Short</tt> object constructed from the string. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NumberFormatException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>String</tt> does not contain a valid representation 
of a <tt CLASS=literal>short</tt>, <tt CLASS=literal>radix</tt> 
is not in the appropriate range, or 
the value represented by the 
<tt CLASS=literal>String</tt> is less than <tt CLASS=literal>Short.MIN_VALUE</tt>
or greater than <tt CLASS=literal>Short.MAX_VALUE</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Short</tt> object with the value specified by 
the given string in the specified radix. 
The string should consist of one or more digit characters or 
characters in the range `A' to `Z' or `a' to `z' that are considered 
digits in the given radix. The digit characters can be preceded 
by a single `<tt CLASS=literal>-</tt>' character. If the string contains any other 
characters, the method throws a <tt CLASS=literal>NumberFormatException</tt>.</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.144">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.332">byteValue</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.376">public byte byteValue()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value of this object as a <tt CLASS=literal>byte</tt>. 
The high order bits of the value are discarded.

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Number.byteValue()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value of this object as a <tt CLASS=literal>byte</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.333">doubleValue</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.377">public double doubleValue()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value of this object as a <tt CLASS=literal>double</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Number.doubleValue()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value of this object as a <tt CLASS=literal>double</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.334">equals</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.378">public boolean equals(Object obj)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>obj</tt><br>
<DD>

<P CLASS=para>
The object to be compared 
with this object. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if the objects are equal; 
<tt CLASS=literal>false</tt> if they are not. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.equals()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns <tt CLASS=literal>true</tt> if 
<tt CLASS=literal>obj</tt> is an instance of <tt CLASS=literal>Short</tt> 
and it contains the same value as the object this method is associated 
with. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.335">floatValue</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.379">public float floatValue()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value of this object as a <tt CLASS=literal>float</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Number.floatValue()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value of this object as a <tt CLASS=literal>float</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.336">hashCode</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.380">public int hashCode()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A hashcode based on the <tt CLASS=literal>short</tt> 
value of the object. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.hashCode()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a hash code computed from the value of this object. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.337">intValue</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.381">public int intValue()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value of this object as an <tt CLASS=literal>int</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Number.intValue()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value of this object as an <tt CLASS=literal>int</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.338">longValue</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.382">public long longValue()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value of this object as a <tt CLASS=literal>long</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Number.longValue()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value of this object as a <tt CLASS=literal>long</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.339">shortValue</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.383">public short shortValue()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value of this object as a <tt CLASS=literal>short</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Number.shortValue()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value of this object as a <tt CLASS=literal>short</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch10-REFSECT2-AUTOID.340">toString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch10-REFSECT3-AUTOID.384">public String toString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The string representation of the value of this object. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.toString()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a <tt CLASS=literal>String</tt> object that contains the 
decimal representation of the value of this object.

<P CLASS=para>
This method returns a string that begins with `<tt CLASS=literal>-</tt>' if the value 
is negative. The rest of the string is a sequence of one or more of the 
characters `0', `1', `2', `3', 
`4', `5', `6', `7', `8', 
and `9'. This method returns "0" if the value of 
the object is <tt CLASS=literal>0</tt>. Otherwise, the string returned by this 
method does not begin with "0" or "-0". </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.145">Inherited Methods</A></h2>

<DIV CLASS=informaltable>
<P>
<TABLE CLASS=INFORMALTABLE>
<TR CLASS=row>
<TH ALIGN="LEFT">

<P CLASS=para>
Method</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Inherited From</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Method</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Inherited From</TH>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>clone()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>finalize()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>getClass()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>notify()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>notifyAll()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait(long)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait(long, int)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
</TABLE>
<P>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch10-REFSECT1-AUTOID.146">See Also</A></h2>

<P CLASS=para>
<A HREF="ch10_02.htm">Byte</A>;
<A HREF="ch10_03.htm">Character</A>;
<A HREF="ch10_04.htm">Class</A>;
<A HREF="ch10_08.htm">Double</A>;
<A HREF="ch09_04.htm#JLR2-CH-9-SECT-4.1">Exceptions</A>;
<A HREF="ch10_09.htm">Float</A>;
<A HREF="ch02_02.htm#JLR2-CH-2-SECT-2.3.1">Integer literals</A>;
<A HREF="ch03_01.htm#JLR2-CH-3-SECT-1.1.1">Integer types</A>;
<A HREF="ch10_10.htm">Integer</A>;
<A HREF="ch10_11.htm">Long</A>;
<A HREF="ch10_13.htm">Number</A>;
<A HREF="ch10_20.htm">String</A>

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch10_18.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch10_20.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>SecurityManager</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>String</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
